package com.fau.ss.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.GenericGenerator;
import org.json.simple.JSONAware;
import org.json.simple.JSONObject;

/**
 * @desc 电话信息表
 * @author yangzj
 * @datetime 2014年10月17日,下午5:25:51
 */
@Entity
@Table(name = "medical_call_tel_info")
public class MedicalCallTelInfo implements Serializable, JSONAware {

	private static final long serialVersionUID = 2326582060988878179L;

	private String id; 			// 话务电话信息表id
	private String phoneNum; 	// 号码
	private String type; 		// 类型(固话,手机)
	private String isMain; 		// 是否主要
	private String remarks; 	// 备注
	private String customerId; 	// 话务客户表id
	private String callId;		// 话务任务id
	private Date createTime = new Date();	// 创建时间
	private Date updateTime = new Date();	// 更新时间
	
	@Id
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@GeneratedValue(generator = "generator")
	@Column(name = "id", length = 32)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "phone_num", length = 20)
	public String getPhoneNum() {
		return phoneNum;
	}

	public void setPhoneNum(String phoneNum) {
		this.phoneNum = phoneNum;
	}

	@Column(name = "type", length = 10)
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "is_main", length = 10)
	public String getIsMain() {
		return isMain;
	}

	public void setIsMain(String isMain) {
		this.isMain = isMain;
	}

	@Column(name = "remarks", length = 1000)
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	@Column(name = "customer_id", length = 32)
	public String getCustomerId() {
		return customerId;
	}
	
	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}
	
	@Column(name = "call_id", length = 32)
	public String getCallId() {
		return callId;
	}

	public void setCallId(String callId) {
		this.callId = callId;
	}
	
	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_time")
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String toJSONString() {
		JSONObject obj = new JSONObject();
		obj.put("id", id);
		obj.put("phoneNum", phoneNum);
		obj.put("isMain", isMain);
		if(StringUtils.isNotBlank(type)) {
			obj.put("type", type);
		}else {}
		
		if(StringUtils.isNotBlank(remarks)) {
			obj.put("remarks", remarks);
		}else {}
		
		
		return obj.toString();
	}
}
